import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import pages from "~pages";
// console.log(pages);
const routes: Array<RouteRecordRaw> = [
  ...pages,
  {
    path: "/",
    redirect: "/applyAndDown",
    // redirect: "/applyAndDown?code=JDLC000001",
  },

  {
    path: "/applyAndDown",
    name: "applyAndDown",
    component: () =>
      import(/* webpackChunkName: "applyAndDown" */ "@/views/ApplyAndDown.vue"),
  },

  {
    path: "/aiqian",
    name: "aiqian",
    component: () =>
      import(/* webpackChunkName: "aiqian" */ "@/views/Aiqian.vue"),
  },
  {
    path: "/userAgreement",
    name: "userAgreement",
    component: () =>
      import(
        /* webpackChunkName: "userAgreement" */ "@/views/UserAgreement.vue"
      ),
  },
  {
    path: "/privacyAgreement",
    name: "privacyAgreement",
    component: () =>
      import(
        /* webpackChunkName: "privacyAgreement" */ "@/views/PrivacyAgreement.vue"
      ),
  },
  {
    path: "/contract",
    name: "contract",
    component: () =>
      import(/* webpackChunkName: "contract" */ "@/views/Contract.vue"),
  },
  {
    path: "/privacyPolicyyp",
    name: "privacyPolicyyp",
    component: () =>
      import(
        /* webpackChunkName: "contract" */ "@/views/aggrementyp/PrivacyPolicy.vue"
      ),
  },
  {
    path: "/serviceAgreementyp",
    name: "serviceAgreementyp",
    component: () =>
      import(
        /* webpackChunkName: "contract" */ "@/views/aggrementyp/ServiceAgreement.vue"
      ),
  },
  {
    path: "/wxpay",
    name: "wxpay",
    component: () =>
      import(/* webpackChunkName: "contract" */ "@/views/Wxpay.vue"),
  },
  {
    path: "/payFinish",
    name: "payFinish",
    component: () =>
      import(/* webpackChunkName: "contract" */ "@/views/payFinish.vue"),
  },
];

console.log("----", routes);
const router = createRouter({
  history: createWebHistory(),
  routes,
});

router.onError((error) => {
  console.log("路由错误： ", error);
});

export default router;
